package com.jh.loadbalance.client.service.rest;

import com.jh.loadbalance.client.custom.rest.RestClient;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.lang.reflect.Method;
import java.util.stream.Stream;

@RestClient(name = "${dyn.custom.service.name}")
public interface SayingRestService {

    @GetMapping("/message/{message}")
    String say(@PathVariable String message);

    public static void main(String[] args) {
        Method method = ReflectionUtils.findMethod(SayingRestService.class, "say", String.class);
        DefaultParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer();
        Stream.of(nameDiscoverer.getParameterNames(method)).forEach(System.out::println);
    }

}
